#1.为celery使用django配置环境(manage.py)
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meiduo_mall.settings")
#2.创建Celery实例
from celery import Celery
#用脚本路径
celery_app = Celery('celery_tasks')
#3.设置broker,通过配置文件
celery_app.config_from_object('celery_tasks.config')
# 4.自动注册celery任务
celery_app.autodiscover_tasks(['celery_tasks.sms','celery_tasks.email'])
#5.启动Celery服务:celery -A celery_tasks.main worker -l info
